<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>日志查询</title>
    {include file="include/top"}
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="text-align: left;">
            <div class="layui-inline">
                <label class="layui-form-label">用户ID</label>
                <div class="layui-input-inline">
                    <input type="text" name="uid" placeholder="请填入用户ID" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">行为</label>
                <div class="layui-input-inline">
                    <input type="text" name="action" placeholder="行为:adminauth/adduser" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">时间段</label>
                <div class="layui-input-inline" style="width: 200px;display: flex;">
                    <input type="text" name="date1" id="date1" lay-verify="date1" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                    <input type="text" name="date2" id="date2" lay-verify="date2" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                </button>
            </div>
        </div>
        <table class="layui-table" lay-data="{height:0, url:'/log/loglist', page:true, id:'idTest'}" lay-filter="demo">
            <thead>
            <tr>
                <th lay-data="{field:'id', sort: true, fixed: 'left',width:70}">ID</th>
                <th lay-data="{field:'fullname'}">姓名</th>
                <th lay-data="{field:'info'}">事件</th>
                <th lay-data="{field:'pid'}">事件说明</th>
                <th lay-data="{field:'ctype'}">详细数据</th>
                <th lay-data="{field:'content'}">结果</th>
                <th lay-data="{field:'addtime'}">时间</th>
<!--                <th lay-data="{toolbar: '#barDemo',width:120,fixed: 'right'}"></th>-->
            </tr>
            </thead>
        </table>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="edit">详情</a>
        </script>
    </div>
</div>
{include file="include/js"}
<script>
    layui.config({
        base: '../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'contlist', 'table','form','laydate'], function() {
            var table = layui.table;
            var temarr = "";
            var form = layui.form;
            var laydate = layui.laydate;
            var $ = layui.$, active = {}
        //日期
        laydate.render({
            elem: '#date1'
        });
        laydate.render({
            elem: '#date2'
        });
        table.on('tool(demo)', function(obj){
            var data = obj.data;
            if(obj.event === 'edit'){
                $.getJSON("/log/info?id="+data.id,function (re) {
                    if(re.code==0){
                        layer.open({
                            title: '详情'
                            ,content: re.msg
                        });
                    }else{
                        layer.msg(re.msg);
                    }
                })
            }
        })
        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            field.page=1;
            //执行重载
            table.reload('idTest', {
                where: field
            });
        });
    })
</script>
</body>
</html>
